home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / cli / bangtools.lha / USAGE < prev   
Text File  |  1995-01-15  |  4KB  |  86 lines

  1. CALLFUNC - Shell command to call shared library functions.
  2.  
  3. Usage:
  4.     a) callfunc open <libname> [version <n>]
  5.         Open a library and print its base. Use it like this:
  6.             set intuibase `callfunc open intuition.library`
  7.  
  8.         Sets a WARN returncode if the library could not be opened.
  9.         Don't forget to close the library later in your script!
  10.  
  11.     b) callfunc close <libbase>
  12.         Closes a library.  Example:
  13.             callfunc close $intuibase
  14.  
  15.         Sets a WARN returncode if the base is invalid.
  16.  
  17.     c) callfunc <offset> from <libname/libbase> [D0=<val>] [D1=<val> etc] [A0=<val>] [A1=<val> etc] [void]
  18.         Call a library function. If the 'from' argument can be interpreted as
  19.         a library base it is used, otherwise it is interpreted as a library name:
  20.  
  21.             callfunc 96 from $intuibase void
  22.                 Calls DisplayBeep() with the previously opened
  23.                 intuition.library.
  24.  
  25.             callfunc 96 from intuition.library void
  26.                 Opens intuition.library, calls DisplayBeep() and closes the
  27.                 library.
  28.  
  29.         Prints the value that is returned from the function in D0, unless
  30.         the 'void' keyword is used.  The offset must be decimal and can be
  31.         positive or negative.  Register values can be given as decimal,
  32.         hex (prefix 0x) or octal (prefix 0) numbers, or strings (prefix @).
  33.         All registers are set to 0 as default.  For strings, the register
  34.         is loaded with the address of the characters after the '@'; for
  35.         example, this is a replacement for the AmigaDOS "rename" command:
  36.             callfunc 78 from dos.library D1 @oldname D2 @newname
  37.  
  38.  
  39. A more sophisticated example:
  40.  
  41.     set execbase `callfunc open exec.library`
  42.     set mem `callfunc 198 from $execbase D0=200 D1=0x01`    ; mem = AllocMem(200, MEMF_PUBLIC)
  43.     memcopy "Hello World*N" to $mem                         ; strcpy(mem, "Hello world\n")
  44.     callfunc 948 from dos.library D1=$mem void              ; PutStr(mem)
  45.     callfunc 210 from $execbase A1=$mem D0=200 void         ; FreeMem(mem, 200)
  46.     callfunc close $execbase
  47.  
  48. -----------------------------------------------------------------------------
  49.  
  50. MEMCOPY - copy memory contents, or a string into memory
  51.  
  52. Usage:
  53.     a) memcopy from <addr1> to <addr2> [num <n>]
  54.         Copy upto <n> bytes of memory from <addr1> to <addr2>.
  55.         If no number if given, copies until a 0-byte is encountered
  56.         (including this byte).  This mode is used if <addr1> can be
  57.         interpreted as an address (is a number, either decimal, octal
  58.         (prefix 0) or hexadecimal (prefix 0x)).
  59.  
  60.     b) memcopy <string> to <addr> [num <n>] [string]
  61.         Copy <string> into memory at <addr>.
  62.         This mode is used if the first argument cannot be interpreted
  63.         as an address, or the keyword "string" is used.
  64.  
  65. See callfunc for an example.
  66.  
  67. -----------------------------------------------------------------------------
  68.  
  69. PEEK - read value from memory
  70. POKE - wite a value to memory
  71.  
  72. Usage:
  73.     peek <addr> [BYTE|B|S|SHORT|W|WORD|L|LONG] [H|X|HEX]
  74.  
  75.     Reads the value from memory location <addr> and print it as decimal or
  76.     hexadecimal (keyword "X", "H", or "HEX").  Reads either a byte (default,
  77.     or keyword "B" or "BYTE"), a 16bit-value (keyword "S", "SHORT", "W" or
  78.     "WORD") or a 32bit-value (keyword "L" or "LONG").
  79.     Remember that reading a 16bit- or 32bit-value from an odd address results
  80.     in a bus error on 68000 CPUs.
  81.  
  82.     poke <addr> <value> [BYTE|B|S|SHORT|W|WORD|L|LONG]
  83.  
  84.     Write a value to memory.  The flags have the same meaning as for "peek".
  85.  
  86.